export function setupRouterGuard(router) {
  router.beforeEach((to, from, next) => {
    const token = localStorage.getItem('token')
    
    // 检查是否需要登录
    if (to.meta.requiresAuth && !token) {
      return next({ name: 'Login' })
    }
    
    // 检查是否需要访客状态
    if (to.meta.requiresGuest && token) {
      return next({ name: 'Home' })
    }
    
    next()
  })
}